package com.antler.smt.admin.controller;

import com.antler.smt.admin.annotation.OperateCut;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.admin.AuditService;
import com.antler.smt.utils.LogUtil;
import com.antler.smt.validate.DataValidator;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 新增人员审核控制
 *
 * @author zhangyi
 * @date 2018/7/17 11:19
 */
@RestController
@RequestMapping("/audit")
public class AuditController {
    /**
     * 日志
     */
    private Logger log = LogUtil.get();

    @Resource
    private AuditService auditService;

    /**
     * 发布需求审核
     *
     * @param id
     * @param auditStatus
     * @return
     */
    @PostMapping("/auditRecruitmentInfo/{id}/{auditStatus}")
    @ApiOperation(value = "2审核通过，3审核不通过(id：发布需求信息id)",httpMethod = "POST")
    @OperateCut(content = "审核发布需求信息")
    public Result auditRecruitmentInfo(@PathVariable("id") Long id,@PathVariable("auditStatus") Integer auditStatus){
        DataValidator.isBlank(String.valueOf(auditStatus),"审核状态不能为空！");
        return auditService.auditRecruitmentInfo(id,auditStatus);
    }

    /**
     * 人员认证信息审核
     *
     * @param id
     * @param auditStatus
     * @return
     */
    @PostMapping("/auditPeople/{id}/{auditStatus}")
    @ApiOperation(value = "2审核通过，3审核不通过(id：人员信息id)",httpMethod = "POST")
    @OperateCut(content = "审核人员信息")
    public Result auditPeople(@PathVariable("id") Long id,@PathVariable("auditStatus") Integer auditStatus){
        DataValidator.isBlank(String.valueOf(auditStatus),"审核状态不能为空！");
        return auditService.auditPeopleInfo(id,auditStatus);
    }

    /**
     * 工作订单完成后的评价审核
     *
     * @param id
     * @param auditStatus
     * @return
     */
    @PostMapping("/auditComment/{id}/{auditStatus}")
    @ApiOperation(value = "1 审核通过 2 审核不通过(id：评价信息id)",httpMethod = "POST")
    @OperateCut(content = "审核工作评价信息")
    public Result auditJobComment(@PathVariable("id") Long id,@PathVariable("auditStatus") Integer auditStatus){
        DataValidator.isBlank(String.valueOf(auditStatus),"审核状态不能为空！");
        return auditService.autditJobComment(id,auditStatus);
    }

}
